<template>
  <div class='container'>
    <el-row>
      <h2>{{articleContent.title}}</h2>
    </el-row>
    <el-row>
      <span>{{getTime(articleContent.createTime)}}</span>
      <span>{{articleContent.username}}</span>
      <span>{{articleContent.visits}}</span>
    </el-row>
    <div v-html="articleContent.articleBody" class="contentBody"></div>
  </div>
</template>

<script>
import { parseTime } from '@/utils/index.js'
export default {
  props: {
    articleContent: {
      required: true,
      type: Object
    }
  },
  methods: {
    // 格式化时间
    getTime (time) {
      return parseTime(time)
    }
  }
}
</script>

<style scoped>
.contentBody {
  background-color: #f5f5f5;
  padding: 10px;
}
.container span {
  margin-right: 10px;
}
</style>
